home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / rhythmbox / plugins / lyrics / LyricWikiParser.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.4 KB  |  31 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import urllib
  5. import rb
  6. from xml.dom import minidom
  7.  
  8. class LyricWikiParser(object):
  9.     
  10.     def __init__(self, artist, title):
  11.         self.artist = artist
  12.         self.title = title
  13.  
  14.     
  15.     def search(self, callback, *data):
  16.         artist = urllib.quote(self.artist.replace(' ', '_'))
  17.         title = urllib.quote(self.title.replace(' ', '_'))
  18.         htstring = 'http://lyricwiki.org/api.php?artist=%s&song=%s&fmt=text' % (artist, title)
  19.         loader = rb.Loader()
  20.         loader.get_url(htstring, self.got_lyrics, callback, *data)
  21.  
  22.     
  23.     def got_lyrics(self, result, callback, *data):
  24.         if result is None or result == 'Not found':
  25.             callback(None, *data)
  26.             return None
  27.         result += '\n\nLyrics provided by lyricwiki.org'
  28.         callback(result, *data)
  29.  
  30.  
  31.